package com.jeesite.modules.digitalize.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jeesite.modules.digitalize.entity.DigitalizeComponent;
import com.jeesite.modules.digitalize.entity.ResourceLibrary;
import com.jeesite.modules.digitalize.entity.vo.component.ComponentRecycleVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * (DigitalizeComponent)表数据库访问层
 *
 * @author xk
 * @since 2024-01-03 14:28:16
 */
@Mapper
public interface DigitalizeComponentDao extends BaseMapper<DigitalizeComponent> {

    List<ResourceLibrary> getChildList(Long id);

    void updateStatusById(@Param("component") DigitalizeComponent component, @Param("userId") String userId);

    List<ComponentRecycleVo> getRecycleList(@Param("fileName") String fileName,@Param("projectCode") String projectCode);
    @Select("select * from digitalize_component where id = #{id}")
    DigitalizeComponent getByIdAndDelStatus(@Param("id") Integer id);
    @Update("update digitalize_component set del_status = #{component.delStatus}" +
            ",parent_id = #{component.parentId}, update_by = #{component.updateBy},update_date = now() where del_batch = #{component.delBatch}")
    void updateByIdAndDelStatus(@Param("component") DigitalizeComponent component);
    @Update("update digitalize_component set del_status = #{component.delStatus}" +
            ", update_by = #{component.updateBy} ,update_date = now() where id = #{component.id}")
    void updateDel(@Param("component") DigitalizeComponent component);
}

